package com.chenchao.collection.properties;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * @encoding : UTF-8
 * @Time : 2020/12/5 15:22
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.collection.properties.Test01.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class Test01 {
    /*properties是map体系的一员*/
    public static void main(String[] args) {
        /*创建时不能指定类型*/
        Properties properties = new Properties();
        /*添加元素*/
        properties.put("key1","value1");
        properties.put("key2","value2");
        properties.put("key3","value3");
        properties.put("key4","value4");
        /*遍历元素*/
        Set<Map.Entry<Object, Object>> entries = properties.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
    }
}
